#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=450;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
char s[maxn][maxn];
struct P{
   LL x,y;
}p[10];
bool check(LL x,LL y){
     if(x==p[1].x&&y==p[2].y){
        if(abs(y-p[1].y)==abs(x-p[2].x)) return true;
     }
     if(x==p[2].x&&y==p[1].y){
        if(abs(y-p[2].y)==abs(x-p[1].x)) return true;
     }

     return false;
}
int main(void){
   cin.tie(0);std::ios::sync_with_stdio(false);
   LL t;cin>>t;
   while(t--){
      LL n;cin>>n;
      LL tot=0;
      for(LL i=1;i<=n;i++){
        for(LL j=1;j<=n;j++){
            cin>>s[i][j];
            if(s[i][j]=='*'){
                p[++tot].x=i;
                p[tot].y=j;
            }
        }
      }

      bool flag=1;
      for(LL i=1;flag&&i<=n;i++){
          for(LL j=1;flag&&j<=n;j++){
              if(i==p[1].x&&j==p[1].y) continue;
              if(i==p[2].x&&j==p[2].y) continue;
              if(check(i,j)==true){
            ///        debug(i);debug(j);
                    for(LL k=1;flag&&k<=n;k++){
                        for(LL o=1;flag&&o<=n;o++){
                            if(k==p[1].x&&o==p[1].y) continue;
                            if(k==p[2].x&&o==p[2].y) continue;
                            if(k==i&&o==j) continue;
                            if(check(k,o)==true){
                               LL dis1=abs(i-p[1].x)+abs(j-p[1].y);
                               LL dis2=abs(i-p[2].x)+abs(j-p[2].y);
                               LL dis3=abs(k-p[1].x)+abs(o-p[1].y);
                               LL dis4=abs(k-p[2].x)+abs(o-p[2].y);
                               if(dis1==dis2&&dis2==dis3&&dis3==dis4){
                                  flag=0;
                                  s[i][j]='*';
                                  s[k][o]='*';
                                  break;
                               }
                            }
                        }
                    }
                    flag=0;
                    break;
              }
          }
      }
      for(LL i=1;i<=n;i++){
        for(LL j=1;j<=n;j++){
            cout<<s[i][j];
        }
        cout<<"\n";
      }
   }
   return 0;
}
